package com.luna.servlets;

import com.luna.service.PhaseService;
import com.luna.serviceImpl.PhaseServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(
        name = "RemovePhase",
        urlPatterns = "/RemovePhase"
)
public class RemovePhase extends HttpServlet {

    public RemovePhase() {}

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PhaseService phaseService = new PhaseServiceImpl();
        int phase_id = Integer.parseInt(req.getParameter("phase_id"));
        System.out.println(phase_id);
        phaseService.dropPhase(phase_id);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
